UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PdQIiIDIBCyzcjYpoWOYo2D7vDZ+aOfGDbOJvuhbgqc=' 
WHERE 
  key_id = '513953a5a8b188aeb901f5bdf59ae5b3eb30501f79f1c8b9e1e056f4cfa59009' 
  AND (
    token = 'PdQIiIDIBCyzcjYpoWOYo2D7vDZ+aOfGDbOJvuhbgqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043