UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p4DtIChYJLBogZ8H4LmcpZgCpjGsu1ryjSY85pfjliQ=' 
WHERE 
  key_id = '0b81bdc638177c59c45991affd8fdf08a04968e07516c3fcf2adb84c8745bf50' 
  AND (
    token = 'p4DtIChYJLBogZ8H4LmcpZgCpjGsu1ryjSY85pfjliQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022