UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RjPs3jRrfcmFSx6qD+mDTny+blv9SVuVDNwHr2dxW1k=' 
WHERE 
  key_id = '50f1859a4853532c48dc2f6c3a825b5d2e685ca634d5852ac5892875844e3c05' 
  AND (
    token = 'RjPs3jRrfcmFSx6qD+mDTny+blv9SVuVDNwHr2dxW1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026