UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bp86UIZsGA5UlNwFDJ9aBWILGYKNxTGEmXIUWnNqktk=' 
WHERE 
  key_id = 'b996d1cdcc5e8c6c1465cffcbda706566be09b007185067c7d6a0fc9d714d6ae' 
  AND (
    token = 'Bp86UIZsGA5UlNwFDJ9aBWILGYKNxTGEmXIUWnNqktk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040