UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BByrBjSRhnaMrBogFan5bcZrfbvWEiOcaQaX/rkGo60=' 
WHERE 
  key_id = 'cca0b82379744abe0b49ead092c3634ebb18817cc32dfb044185a6a413657ff7' 
  AND (
    token = 'BByrBjSRhnaMrBogFan5bcZrfbvWEiOcaQaX/rkGo60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033