UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9hTFkaEBuw8/IODJRT3CCvIdiYY28n4+U9DUiURs+G0=' 
WHERE 
  key_id = 'a39fa43d90db030e6fbdd9b5f2266906a9e67f7a799deb8383d182f93975f043' 
  AND (
    token = '9hTFkaEBuw8/IODJRT3CCvIdiYY28n4+U9DUiURs+G0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033