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

Query time 0.00052