UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'shkSL96HwxcPD191EPx14oJmtN4s8INamjFWQ13ZXK4=' 
WHERE 
  key_id = 'be419e9d64bf78f4557d726a5e7fb67eb9b1d41ca041bf456dbd9daf52f1099e' 
  AND (
    token = 'shkSL96HwxcPD191EPx14oJmtN4s8INamjFWQ13ZXK4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017