UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XcgLf9Uyt1Tf3bcsOQmtSJDHqSVnsvoi28r+A7pni5k=' 
WHERE 
  key_id = '960c9c917d5f481913217eed1e6425520895084ea260859446c4256a696657bf' 
  AND (
    token = 'XcgLf9Uyt1Tf3bcsOQmtSJDHqSVnsvoi28r+A7pni5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031