UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bgNRkvaO1QfKesX7J+rAwgjWA/qThXj2JL8XrUayaYU=' 
WHERE 
  key_id = '04da1f10c959eca9ac3ee0b427cca76fb4dfdc9165e56a12d35c3fe133f8fcbd' 
  AND (
    token = 'bgNRkvaO1QfKesX7J+rAwgjWA/qThXj2JL8XrUayaYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059