UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+yFwN1qcSBLzgOybXX3x03SK131ZAyFduC3An+tU/g=' 
WHERE 
  key_id = '34a4d619e36cd216b7fd1dc2324c84d326743539f1ceedbb8d948e62badb6974' 
  AND (
    token = 'L+yFwN1qcSBLzgOybXX3x03SK131ZAyFduC3An+tU/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049