UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GAvdwlgfbt1WqwdTIe+4ixhhgpb2/X+8GfS/NAByNz4=' 
WHERE 
  key_id = '22704c4cb0a5062f17fa7983f3b950197ea621bf20aaf7c6adee4de82c5d6fad' 
  AND (
    token = 'GAvdwlgfbt1WqwdTIe+4ixhhgpb2/X+8GfS/NAByNz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056