UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9YNiPspMYVzADPb1LJt2K1flMKKI0bN6vp60438I6A8=' 
WHERE 
  key_id = '7e5aec0a43c26e9a4842440936bef20d8088bb84b0e040728730d1838453d6ec' 
  AND (
    token = '9YNiPspMYVzADPb1LJt2K1flMKKI0bN6vp60438I6A8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055