UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DcMf+kTVrdX15bHKwogSxk6NRtALR2J9lwdsL96Q/ao=' 
WHERE 
  key_id = '3fbfe7e1e24e933cc7a6a9dbd92c7393bb229f6f5f7de3492b54101218087288' 
  AND (
    token = 'DcMf+kTVrdX15bHKwogSxk6NRtALR2J9lwdsL96Q/ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058