UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iiw+IjDpzY+tujXtygMxGkHZ20T1JxaBn4S6EineujY=' 
WHERE 
  key_id = '7648474e8e545ba1d8ab023d5088512162e2801e5ab4ae2283342be4210a71d8' 
  AND (
    token = 'Iiw+IjDpzY+tujXtygMxGkHZ20T1JxaBn4S6EineujY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063