UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uinL4zO5xmCxJ0tXlZvlIfjzDVE+wtSNUbFsRAUDzY0=' 
WHERE 
  key_id = '8f99977767351136859378954ce60b49801d3a992be284c760f420ec0481a7a0' 
  AND (
    token = 'uinL4zO5xmCxJ0tXlZvlIfjzDVE+wtSNUbFsRAUDzY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041