UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ErmjoJ+JNxMmgFbfCUUgmJAcbOKO9F4oZZmLEmY0w78=' 
WHERE 
  key_id = '066f45c3c599233c0f6b57d72f2d89a762cb20bf4abde7f849f2aac46e19b1a6' 
  AND (
    token = 'ErmjoJ+JNxMmgFbfCUUgmJAcbOKO9F4oZZmLEmY0w78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028