UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sFw0x1hO8nadcBv1pH31RbUnwoefWdm8tJufkg5D4mU=' 
WHERE 
  key_id = '6c18a836787beb6234498f2d8ffc9475f954b88c23bacb0e07e875550a267704' 
  AND (
    token = 'sFw0x1hO8nadcBv1pH31RbUnwoefWdm8tJufkg5D4mU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031