UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M1aqIWdtMtlfCOTkA4hQ0fVqo+mOEs8rOaTh+pZN/EA=' 
WHERE 
  key_id = '8d029c953e42e0ff50c360795f5d7dc043aa21188ab047d7d4fef265c880b7bc' 
  AND (
    token = 'M1aqIWdtMtlfCOTkA4hQ0fVqo+mOEs8rOaTh+pZN/EA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033