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

Query time 0.00040