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

Query time 0.00042