UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I9oj4OvxkZM+OGHCj48RbRTYPeVQU8kTEjMVNVHUqMw=' 
WHERE 
  key_id = '80369667123728e0bb9332c068d463ccba65411d1ce1b3a9aaa23258d74e0b38' 
  AND (
    token = 'I9oj4OvxkZM+OGHCj48RbRTYPeVQU8kTEjMVNVHUqMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031