UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mn8UJHZb4pYoZoO6c/e5t2WdpIcZEhuMuN2fmWhfY7U=' 
WHERE 
  key_id = '507aad36e231cc2ac02ccccb252a28894b97e5570b3598dc72cf4689ea721b45' 
  AND (
    token = 'Mn8UJHZb4pYoZoO6c/e5t2WdpIcZEhuMuN2fmWhfY7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037