UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wAVZp7hN220wflC4NDxqlhM6upKmwtn47NsP/y1jy4k=' 
WHERE 
  key_id = '10869e973073b8601815a376cd1012779cc11d427f6172809f5a67b8a5d1431e' 
  AND (
    token = 'wAVZp7hN220wflC4NDxqlhM6upKmwtn47NsP/y1jy4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018