UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MUDcx58mhnk+tz0KLDJdo7d1gT55BnJYfwMMf2PwphA=' 
WHERE 
  key_id = '7dc2d0b082705ab3a55d46b54f66f0251dc6fa7c87c26ef1c019b4338f44f545' 
  AND (
    token = 'MUDcx58mhnk+tz0KLDJdo7d1gT55BnJYfwMMf2PwphA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028