UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qh30mZcARydf2jaOeFdinJ0hW4cjS0ZgYu3H6vgSA8c=' 
WHERE 
  key_id = '784045b441855c696ba33940b3da4956c8d91b51081a58ad9a607263a5f8cf88' 
  AND (
    token = 'qh30mZcARydf2jaOeFdinJ0hW4cjS0ZgYu3H6vgSA8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038