UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EY8wUJye/3zgkKaD5Ma9hjkhvmxEGoQInO87wHJgcSI=' 
WHERE 
  key_id = '1a2f04c1c797870d3c4b01995a1a6b0390af7b6d147dd8effe7bcce76566f266' 
  AND (
    token = 'EY8wUJye/3zgkKaD5Ma9hjkhvmxEGoQInO87wHJgcSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034