UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LLscZ+2TNyMvdcRkdo1ZwGirD3iCaUpJgbn5GxIyTu0=' 
WHERE 
  key_id = '5b92a37417a3fe8987301feda191215b2f275e5ce3ed1861f913c0dc0aa2e723' 
  AND (
    token = 'LLscZ+2TNyMvdcRkdo1ZwGirD3iCaUpJgbn5GxIyTu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025