UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7A1E4kqJa0vIZ4WDjB07E52ZqUDTb45aaInO7VB9nZQ=' 
WHERE 
  key_id = '4a5321de34020f6829c873784b2be17384a513c55772501f60fd8bfc18fffd14' 
  AND (
    token = '7A1E4kqJa0vIZ4WDjB07E52ZqUDTb45aaInO7VB9nZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025